package com.ttx.user.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.text.SimpleDateFormat;
import java.util.Date;

@RestController
@RequestMapping("/account/user")
public class UserController {

    SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
    int accessCount=0;
    @Value("${server.port}")
    int port;

    @GetMapping("/get")
    public String get(){
        accessCount++;
        String result="hello world! 端口:"+port+"  访问次数:"+accessCount+"  时间:"+dateFormat.format(new Date());
        System.out.println(result);
        return result;
    }


}
